package org.example.edusmart.service.impl;

import org.example.edusmart.dao.WorkDao;
import org.example.edusmart.pojo.WorkAnswerPojo;
import org.example.edusmart.pojo.WorkPojo;
import org.example.edusmart.request.TeaOrStu.VerifyPojo;
import org.example.edusmart.service.WorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;

@Service
public class WorkServiceImpl implements WorkService {

    @Autowired
    private WorkDao workDao;

    @Override
    public Integer verifyWork(VerifyPojo verify) {
        Integer result = workDao.verifyWork(verify);
        return result != null ? result : 0;
    }

    @Override
    public void assignWork(WorkPojo work) {
        workDao.assignWork(work);
    }

    @Override
    public void linkWork(int courseId, int workId) {
        workDao.linkWork(courseId, workId);
    }

    @Override
    public List<HashMap<String, Object>> getWork(int courseId) {
        return workDao.getWork(courseId);
    }

    @Override
    public void handWork(WorkAnswerPojo answer) {
        workDao.handWork(answer);
    }

    @Override
    public List<HashMap<String, Object>> correctWork(int workanswerId) {
        return workDao.correctWork(workanswerId);
    }

    @Override
    public void scoreWork(int workanswerId, int grade) {
        workDao.scoreWork(workanswerId, grade);
    }

    @Override
    public Integer getWorkGrade(int workId, int userId){
        return workDao.getWorkGrade(workId, userId);
    }

    @Override
    public Integer getWorkStatus(int workId, int userId) {
        return workDao.getWorkStatus(workId, userId);
    }

    @Override
    public List<HashMap<String, Object>> getUncorrectedWork(int workId) {
        return workDao.getUncorrectedWork(workId);
    }

    @Override
    public void rehandWork(WorkAnswerPojo answer) {
        workDao.rehandWork(answer);
    }

}
